

function addSensorbitCod(Blockly) {





    //获取避障的模拟值
   Blockly.Python.microbit_AvoidanceAnalog = function(block) {
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    var dropdown_AvoidanceAnalog = this.getFieldValue('avoidanceAnalog');
    //Blockly.Python.definitions_['import_shockAnalog' + dropdown_shockAnalog] = 'shockAnalog' + dropdown_shockAnalog + ' = ' + dropdown_shockAnalog;
    var code = dropdown_AvoidanceAnalog +  ".read_analog()";
    return [code];
  }
  
  //  获取避障的数字值
  Blockly.Python.microbit_AvoidanceDigital = function(block) {
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    var dropdown_AvoidanceDigital = this.getFieldValue('avoidanceDigital');
    //Blockly.Python.definitions_['import_shockDigital' + dropdown_shockDigital] = 'shockDigital' + dropdown_shockDigital + ' = ' + dropdown_shockDigital;
    var code = dropdown_AvoidanceDigital +  ".read_digital()";
    return [code];
  }

    return Blockly;
}

module.exports = addSensorbitCod;

